package day03;
//逻辑运算符的演示
public class OperDemo3 {
    public static void main(String[] args) {
        //逻辑运算符:&& || !
        int a=5,b=10,c=5;
        boolean d = b>a&&c<b;
        System.out.println(d);
        System.out.println(b<=c && a>c);
        System.out.println(a==c && b>c);
        System.out.println(b!=c || a==c);

        int age=22;
        System.out.println(age>=18 && age<=60);

        int score=90;
        System.out.println(score>=60 && score<=100);
        System.out.println("---------------------------------");
        int a1=5,b1=10,c1=5;
        System.out.println(b1<=a1 || c1>a1);
        System.out.println(b1!=a1 || c1!=a1);
        System.out.println(a1==b1 || b1==c1);

        int age1 = 22;
        System.out.println(age1<0 || age1>100);

        boolean e=!(a1>b1);
        System.out.println(e);
        System.out.println(!(a1>b1));
        System.out.println("---------------------------------");
        /*  && || 和 & |区别是前者若左边关系运算结果能直接判断出逻辑运算结果则
        不进行逻辑运算的右边，后者逻辑运算结果一致不过运算符右边的关系运算一样要进行
         */
        int a2=5,b2=6,c2=7;
        boolean d2= a2>b2 && c2++>2;// &&在逻辑运算左边的关系运算为False时直接为false，右边的关系运算不进行
        System.out.println(d2);
        System.out.println(c2);

        boolean e2 = a2<b2 || c2++>2;// ||在逻辑运算左边的关系运算为True时直接为true，右边的关系运算不进行
        System.out.println(e2);
        System.out.println(c2);
    }
}
